Electronic display devices, such as computer monitors and television sets, display images, objects and scenes which are made up of a large number of pixels. Pixels are rectangular dots arranged in an array on the screen of the display monitor. In a color display, each pixel is defined by a particular color. The color of the pixel is usually specified as a color triplet, i.e. three numbers representing a red, green and blue component of the pixel's color. When properly arranged and viewed as a whole, the pixels form the image, object or scene being displayed. A printed image may also be formed of pixels.
Because pixels have a rectangular shape, it can be difficult to represent a diagonal or curved edge of an object without giving that edge a stair-stepped or jagged appearance. Anti-aliasing is term that describes a variety of techniques which are used to smooth the appearance of a diagonal or curved edge which must be rendered on a print medium or on an electronic display using rectangular pixels.
The basic idea behind anti-aliasing involves altering the pixels along such a curved or diagonal edge to a color between that of the color inside and outside the edge. The edge thus appears much smoother that would be the case otherwise. An example of this type of anti-aliasing is provided by black text characters (which have diagonal and curved edges) on a white background. Without anti-aliasing, diagonal edges appear jagged, like staircases, which may be noticeable, particularly on a low resolution display.
However, if the display can show intermediate shades of gray, then anti-aliasing can be applied. For example, a pixel will be black if it is completely within one of the text characters, white if it is completely within the background, or an intermediate shade of gray according to the proportions of the pixel which overlap the black and white areas. The same technique works similarly with other foreground and background colors.
A common implementation of anti-aliasing involves electronically rendering the entire image at a resolution higher than that of the final output provided to the display monitor. A weighted resampling is then performed on the image data to reduce the resolution of the image. The resampling reduces the resolution to that specified for output to the display monitor.
While providing an anti-aliasing effect, this technique is, however, inefficient. For example, all parts of the image are subject to the anti-aliasing process, when anti-aliasing need only be performed on pixels depicting edges within the image. This technique also increases the time required to render an image because the entire image must be created at a higher resolution and then redacted for output. Additional cost is incurred to supply the extra memory required to hold the higher resolution image data during processing.
Another anti-aliasing technique adds extra information for each pixel within the displayed image. This additional information includes a flag for each pixel situated on an edge of an object within the displayed image and specifies a sub-pixel geometry for the object or objects of which that pixel is a part.
While, this technique provides an anti-aliasing effect, it is still highly inefficient. For example, in order to accommodate the extra information that may be associated with any pixel, the system's data buffer, called a Z-buffer, must be greatly expanded into an anti-aliasing buffer or A-buffer.
A traditional prior art Z-buffer is a fixed set of memory where there is a color, some number of control flags and a Z-distance value kept for every pixel location on the display screen. When data defining a particular fragment of a polygon arrives from a rendering engine (e.g., a rasterizer or a texture unit), it has a specific pixel location it is assigned to that is correlated to a specific memory location in the Z-buffer. If that location does not yet have a fragment assigned then the incoming data is placed in the Z-buffer at that location. In the case where data for a fragment associated with a particular pixel is received in the Z-buffer and data for another fragment associated with that same pixel has already been stored in the Z-buffer, then the Z values of the incoming fragment and the current location contents are compared. If the incoming fragment has a Z distance that is greater than the current entry in the Z-buffer, the incoming data is discarded or ignored. If the incoming fragment has a smaller Z-distance, the data of the incoming fragment replaces the current Z-buffer entry for that pixel. The result for equal Z values is usually controllable through a register setting.
A Z-buffer may also support partial transparency in the displayed image by applying rules that define how an incoming fragment may or may not be blended with the current Z-buffer contents. If the Z-buffer supports partial transparency then there is an extra bit and a transparency level value added to each fragment and each Z-buffer location to indicate whether transparency is being applied and what the blending level is.
The difference between an A-buffer and a Z-buffer is that an A-buffer keeps stacks of fragment data at edge locations and a Z-buffer does not. Regardless of the number of edge fragments applied, the “depth” of the Z buffer at a particular location does not change. In contrast, an A-buffer provides enough memory space for the data of each pixel to accommodate all the data described above. If that pixel is situated on an edge within the displayed image, it has additional Z-distance and sub-pixel geometry information for each underlying polygon fragment(s). In an A-buffer, each edge pixel location may have an entire stack of polygonal fragments associated therewith, for which data must be stored.
Some implementations of A-buffers do not perform an entire sub-sampling of the sub-pixel geometry and seams may occur. In such implementations, it may be necessary to draw all the objects on the display monitor twice in an attempt to eliminate these seams. This frequently results in visual artifacts on the screen, i.e., ghost images that are not intended as part of the displayed image. A high-quality A-buffer can eliminate these problems with visual artifacts, but incurs the cost of maintaining the exact sub-pixel geometry for each fragment of the objects being displayed. Such a high-quality A-buffer, and the complexity of the control mechanisms required to operate it, add excessively to the expense of the system.